package com.huirui.server.pojo.dto;

import lombok.Data;

import java.util.List;

import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import lombok.Data;
import java.util.List;

@Data
public class OrderPrepareInfoDTO {

    /**
     * 订单商品项列表：非空且至少包含1项
     */
    @NotEmpty(message = "订单商品项列表不能为空")
    @Valid // 嵌套校验：校验List中的OrderPrepareInfoItem对象
    private List<OrderPrepareInfoItem> orderPrepareInfoItems;

    @Data
    public static class OrderPrepareInfoItem {

        /**
         * 商品ID：非空且为正数
         */
        @NotNull(message = "商品ID不能为空")
        @Positive(message = "商品ID必须为正整数")
        private Long productId;

        /**
         * 商品规格ID：非空且为正数
         */
        @NotNull(message = "商品规格ID不能为空")
        @Positive(message = "商品规格ID必须为正整数")
        private Long productSpecificationId;

        /**
         * 购买数量：非空且至少为1
         */
        @NotNull(message = "商品数量不能为空")
        @Positive(message = "商品数量必须至少为1")
        private Long quantity;
    }
}
